using System.IO;
using Migrator.Framework;

namespace WineCellar.Migrator
{
    [Migration(3)]
    public class Migration003AddWineRelatedTables :Migration
    {
        public override void Up()
        {
            string sql;
            using (StreamReader rdr = File.OpenText(@"..\..\Core\WineCellar.Migrator\AddWineRelatedTables.sql"))
            {
                sql = rdr.ReadToEnd();
            }
            Database.ExecuteNonQuery(sql);
        }

        public override void Down()
        {
            Database.RemoveTable("Cellar2Wines");
            Database.RemoveTable("Raisins2Wines");
            Database.RemoveTable("Wines");            
            Database.RemoveTable("Raisins");
            Database.RemoveTable("Region");           
            Database.RemoveTable("Cellar");
        }
    }
}